/*
 * CriarFonteEletromagnetica.java
 *
 * Created on 17 de Novembro de 2008, 08:05
 */

package br.com.cpqd.ssar.mediador.gui;

import br.com.cpqd.ssar.mediador.ControladorFonteEletromagnetica;
import br.com.cpqd.ssar.utilitarias.FonteEletromagnetica;
import br.com.cpqd.ssar.utilitarias.TiposdeFonteEletromagnetica;
import java.awt.Color;
import java.io.IOException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JColorChooser;

/**
 *
 * @author  carlos
 */
public class JanelaEditarFonteEletromagnetica extends javax.swing.JDialog {

private ControladorFonteEletromagnetica controladorFonteEletromagnetica;
    
    public JanelaEditarFonteEletromagnetica(java.awt.Frame parent, boolean modal) throws IOException {
        super(parent, modal);
        controladorFonteEletromagnetica = new ControladorFonteEletromagnetica();
        initComponents();              
        
        mudarPropriedadesJanela(0);
    }
    

    /**
     * Tenta Aplicar as Propriedades Editadas
     */
    private FonteEletromagnetica tentarAplicarPropriedades() {
        boolean nenhumErro  = true;
        Vector vetor        = new Vector();        
        TiposdeFonteEletromagnetica tipofonte;
        
        // Testar P1
        try {
            if (jtxtP1.isEnabled()==true)
                vetor.add(Double.valueOf(jtxtP1.getText()));
        } catch (Exception e) {
            jtxtP1.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        // Testar P2
        try {
            if (jtxtP2.isEnabled()==true)
                vetor.add(Double.valueOf(jtxtP2.getText()));
        } catch (Exception e) {
            jtxtP2.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        // Testar P3
        try {
            if (jtxtP3.isEnabled()==true)
                vetor.add(Double.valueOf(jtxtP3.getText()));
        } catch (Exception e) {
            jtxtP3.setForeground(Color.RED);
            nenhumErro = false;
        }

        // Testar P4
        try {
            if (jtxtP4.isVisible()==true)
                vetor.add(Double.valueOf(jtxtP4.getText()));
        } catch (Exception e) {
            jtxtP4.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        if (nenhumErro) {           
            // Retornar o tipo de fonte eletromagnetica selecionada
            tipofonte = new TiposdeFonteEletromagnetica();
            tipofonte = (TiposdeFonteEletromagnetica) jComboBoxFontes.getSelectedItem();            
            FonteEletromagnetica  fonte = new FonteEletromagnetica();
            fonte = (FonteEletromagnetica) jComboBoxNomeFonte.getSelectedItem();                        
            fonte.setIdType(tipofonte.getId());
            fonte.setDirection(jComboDirecao.getSelectedItem().toString());
            fonte.setColor(jPanelCor.getBackground());
            fonte.setField(jComboCampo.getSelectedItem().toString());
            fonte.setParameters(vetor);
            return fonte;
        } else {
//                Toolkit.getDefaultToolkit().beep();
            return null;
        }
    }
    
    /**
     * Muda propriedades apresentadas na Janela
     */
    private void mudarPropriedadesJanela(int status){
        TiposdeFonteEletromagnetica tipofonte = (TiposdeFonteEletromagnetica) jComboBoxFontes.getSelectedItem();
        Vector parameters;  // Utilizado para recuperar os paramateros da fonte
        
        // Atribuir aos Labels e Text Box a invisibilidade
        jlblP1.setVisible(false);
        jlblP2.setVisible(false);
        jlblP3.setVisible(false);
        jlblP4.setVisible(false);
        
        jtxtP1.setVisible(false);
        jtxtP2.setVisible(false);
        jtxtP3.setVisible(false);
        jtxtP4.setVisible(false);

        jlblP1.setEnabled(false);
        jlblP2.setEnabled(false);
        jlblP3.setEnabled(false);
        jlblP4.setEnabled(false);
        
        jtxtP1.setEnabled(false);
        jtxtP2.setEnabled(false);
        jtxtP3.setEnabled(false);
        jtxtP4.setEnabled(false);
        
        if (tipofonte != null){
            if (tipofonte.getNParameters()>0)
            {
                jlblP1.setText(tipofonte.getParameterName(0)+":");
                jlblP1.setVisible(true);
                jtxtP1.setVisible(true);
            }
            if (tipofonte.getNParameters()>1)
            {
                jlblP2.setText(tipofonte.getParameterName(1)+":");
                jlblP2.setVisible(true);
                jtxtP2.setVisible(true);
            }
            if (tipofonte.getNParameters()>2)
            {
                jlblP3.setText(tipofonte.getParameterName(2)+":");
                jlblP3.setVisible(true);
                jtxtP3.setVisible(true);
            }
            if (tipofonte.getNParameters()>3)
            {
                jlblP4.setText(tipofonte.getParameterName(3)+":");
                jlblP4.setVisible(true);
                jtxtP4.setVisible(true);
            }   
            
            if ((jComboCampo.getSelectedIndex()>=1)&&(jComboDirecao.getSelectedIndex()>=1)){
                
                jlblP1.setEnabled(true);
                jlblP2.setEnabled(true);
                jlblP3.setEnabled(true);
                jlblP4.setEnabled(true);
                
                jtxtP1.setEnabled(true);
                jtxtP2.setEnabled(true);
                jtxtP3.setEnabled(true);
                jtxtP4.setEnabled(true);
                
                btnConfirmar.setEnabled(true);                
                
            }
            
            if ((jtxtP1.getText().length()>0)||(jtxtP2.getText().length()>0)||
                (jtxtP3.getText().length()>0)||(jtxtP4.getText().length()>0)){
                btnConfirmar.setEnabled(true);                

            }
            
        }
        
        // --- Alterando os valores dos campos de acordo com a fonte selecionada ---
        FonteEletromagnetica fonte = (FonteEletromagnetica) jComboBoxNomeFonte.getSelectedItem();
        
        if ((fonte!=null)&&(status==0))
        {
            jPanelCor.setBackground(fonte.getColor());
            jComboBoxFontes.setSelectedIndex(fonte.getIdType());
            jComboCampo.setSelectedItem(fonte.getField());
            jComboDirecao.setSelectedItem(fonte.getDirection());

            parameters = new Vector();
            parameters = fonte.getParameters();
            jtxtP1.setText(String.valueOf(parameters.get(0)));

            if (parameters.size()>1)
                jtxtP2.setText(String.valueOf(parameters.get(1)));
            if (parameters.size()>2)
                jtxtP3.setText(String.valueOf(parameters.get(2)));
            if (parameters.size()>3)
                jtxtP4.setText(String.valueOf(parameters.get(3)));        
        }
        else if ((fonte!=null)&&(status==1)){
            
        }
        else {
            System.out.println("Erro: Tentativa de alteração de fonte eletromagnética do usuário");
        }
            
    }        
    
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        btnCancelar = new javax.swing.JButton();
        btnConfirmar = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jComboBoxFontes = new javax.swing.JComboBox();
        jPanelCor = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jComboCampo = new javax.swing.JComboBox();
        jComboDirecao = new javax.swing.JComboBox();
        jtxtP4 = new javax.swing.JTextField();
        jtxtP2 = new javax.swing.JTextField();
        jtxtP1 = new javax.swing.JTextField();
        jtxtP3 = new javax.swing.JTextField();
        jlblP1 = new javax.swing.JLabel();
        jlblP2 = new javax.swing.JLabel();
        jlblP4 = new javax.swing.JLabel();
        jlblP3 = new javax.swing.JLabel();
        jComboBoxNomeFonte = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Criar Fonte Eletromagnética");

        jPanel1.setBackground(new java.awt.Color(231, 240, 250));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Cadastrar Fonte Eletromagnética"));

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/cpqd/ssar/gerenciador/gui/recursos/Cancelar.png"))); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        btnConfirmar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/cpqd/ssar/gerenciador/gui/recursos/confirmar.png"))); // NOI18N
        btnConfirmar.setText("Confirmar");
        btnConfirmar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnConfirmarActionPerformed(evt);
            }
        });

        jLabel2.setText("Nome: ");

        jLabel1.setText("Fonte:");

        jComboBoxFontes.setModel(controladorFonteEletromagnetica.getModelo());
        jComboBoxFontes.setActionCommand("");
        jComboBoxFontes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxFontesActionPerformed(evt);
            }
        });

        jPanelCor.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102)));
        jPanelCor.setToolTipText("Cor do Material");
        jPanelCor.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jPanelCorMousePressed(evt);
            }
        });

        javax.swing.GroupLayout jPanelCorLayout = new javax.swing.GroupLayout(jPanelCor);
        jPanelCor.setLayout(jPanelCorLayout);
        jPanelCorLayout.setHorizontalGroup(
            jPanelCorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 39, Short.MAX_VALUE)
        );
        jPanelCorLayout.setVerticalGroup(
            jPanelCorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 19, Short.MAX_VALUE)
        );

        jLabel3.setText("Campo: ");

        jLabel4.setText("Direção:");

        jComboCampo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-- Selecionar --", "Elétrico", "Magnético" }));
        jComboCampo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboCampojComboBoxCampo(evt);
            }
        });

        jComboDirecao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-- Selecionar --", "x", "y", "z" }));
        jComboDirecao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboDirecaojComboBoxDirecao(evt);
            }
        });

        jtxtP4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtP4Action(evt);
            }
        });

        jtxtP2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtP2Action(evt);
            }
        });

        jtxtP1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtP1Action(evt);
            }
        });

        jtxtP3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtP3Action(evt);
            }
        });

        jlblP1.setText("p1:");

        jlblP2.setText("p2:");

        jlblP4.setText("p4:");

        jlblP3.setText("p3:");

        jComboBoxNomeFonte.setModel(controladorFonteEletromagnetica.getModeloEditavel());
        jComboBoxNomeFonte.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxNomeFonteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addGap(10, 10, 10)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jComboBoxNomeFonte, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jPanelCor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jComboBoxFontes, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addContainerGap(219, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jlblP4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jlblP3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jlblP2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jlblP1, javax.swing.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE))
                        .addGap(4, 4, 4)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jtxtP4)
                            .addComponent(jtxtP3)
                            .addComponent(jtxtP2)
                            .addComponent(jtxtP1, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE))
                        .addGap(77, 77, 77))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(10, 10, 10)
                        .addComponent(jComboCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(392, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(10, 10, 10)
                        .addComponent(jComboDirecao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(392, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(btnConfirmar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnCancelar))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jComboBoxNomeFonte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(jPanelCor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel1)
                    .addComponent(jComboBoxFontes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel3)
                    .addComponent(jComboCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel4)
                    .addComponent(jComboDirecao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlblP1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblP2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtxtP2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(14, 14, 14)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblP3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtxtP3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlblP4, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtxtP4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 5, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCancelar)
                    .addComponent(btnConfirmar))
                .addGap(21, 21, 21))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnConfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConfirmarActionPerformed
    FonteEletromagnetica fonte = this.tentarAplicarPropriedades();
    if (fonte==null){
        
    } else {
            try {
                controladorFonteEletromagnetica.editarFonte(fonte);
                dispose();
            } catch (IOException ex) {
                Logger.getLogger(JanelaEditarFonteEletromagnetica.class.getName()).log(Level.SEVERE, null, ex);
            }
    }

}//GEN-LAST:event_btnConfirmarActionPerformed

private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
// TODO add your handling code here:
    dispose();
    
}//GEN-LAST:event_btnCancelarActionPerformed

private void jComboBoxFontesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxFontesActionPerformed
// TODO add your handling code here:
    this.mudarPropriedadesJanela(1);
}//GEN-LAST:event_jComboBoxFontesActionPerformed

private void jComboCampojComboBoxCampo(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboCampojComboBoxCampo
this.mudarPropriedadesJanela(1);
}//GEN-LAST:event_jComboCampojComboBoxCampo

private void jComboDirecaojComboBoxDirecao(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboDirecaojComboBoxDirecao
this.mudarPropriedadesJanela(0);
}//GEN-LAST:event_jComboDirecaojComboBoxDirecao

private void jtxtP4Action(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtP4Action

}//GEN-LAST:event_jtxtP4Action

private void jtxtP2Action(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtP2Action

}//GEN-LAST:event_jtxtP2Action

private void jtxtP1Action(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtP1Action

}//GEN-LAST:event_jtxtP1Action

private void jtxtP3Action(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtP3Action

}//GEN-LAST:event_jtxtP3Action

private void jPanelCorMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanelCorMousePressed
    JColorChooser jColorChooser = new JColorChooser();                                                 
    jPanelCor.setBackground(JColorChooser.showDialog(null, "Escolher uma Cor", Color.BLACK));
// TODO add your handling code here:
}//GEN-LAST:event_jPanelCorMousePressed

private void jComboBoxNomeFonteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxNomeFonteActionPerformed
mudarPropriedadesJanela(0);
}//GEN-LAST:event_jComboBoxNomeFonteActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnConfirmar;
    private javax.swing.JComboBox jComboBoxFontes;
    private javax.swing.JComboBox jComboBoxNomeFonte;
    private javax.swing.JComboBox jComboCampo;
    private javax.swing.JComboBox jComboDirecao;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanelCor;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JLabel jlblP1;
    private javax.swing.JLabel jlblP2;
    private javax.swing.JLabel jlblP3;
    private javax.swing.JLabel jlblP4;
    private javax.swing.JTextField jtxtP1;
    private javax.swing.JTextField jtxtP2;
    private javax.swing.JTextField jtxtP3;
    private javax.swing.JTextField jtxtP4;
    // End of variables declaration//GEN-END:variables

}
